package com.sam.demo.spring.boot.jpa.domain.service;

import com.sam.demo.spring.boot.jpa.primary.PrimaryUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserFacade {


	@Autowired
	private PrimaryUserService primaryUserService;

	@Autowired
	private SecondaryUserService secondaryUserService;
	
	@Transactional
	public void saveUser(String name) {
		primaryUserService.saveUser(name);
		secondaryUserService.saveUser(name);

		//throw new RuntimeException();
	}

	public PrimaryUser findPrimaryUserById(Long id){
		return primaryUserService.findUserById(id);
	}
	
}
